package com.yuexunit.operationman.nbsy.module.DisarmTrap.ui;

import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.base.ExitApplication;
import com.yuexunit.operationman.nbsy.config.AppConfig;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/3/6 0006.
 */

public class Act_DisarmTrap_Preview extends BaseKJActivity {
    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.placement_preview_01)
    TextView placementPreview01;
    @Bind(R.id.placement_preview_02)
    TextView placementPreview02;
    @Bind(R.id.placement_preview_03)
    TextView placementPreview03;
    @Bind(R.id.placement_preview_04)
    TextView placementPreview04;
    @Bind(R.id.placement_preview_05)
    TextView placementPreview05;
    @Bind(R.id.placement_preview_06)
    TextView placementPreview06;
    @Bind(R.id.placement_preview_07)
    TextView placementPreview07;
    @Bind(R.id.placement_preview_08)
    TextView placementPreview08;
    @Bind(R.id.placement_preview_09)
    TextView placementPreview09;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_placement_preview);
        ButterKnife.bind(this);
        ExitApplication.getInstance().addActivity(this);
    }

    @Override
    public void initData() {
        super.initData();
        setTitle();
        setContent();
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.DISARMTRAPBEAN.getObject().getPatientName());
        if (AppConfig.DISARMTRAPBEAN.getObject().getSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.DISARMTRAPBEAN.getObject().getSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.DISARMTRAPBEAN.getObject().getHospitalNo());
        tvPatientDisease.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DISEASE));
    }

    private void setContent() {
        if(AppConfig.DISARMTRAPBEAN.getObject().getOperationDate()!=null) {
            placementPreview01.setText(AppConfig.DISARMTRAPBEAN.getObject().getOperationDate());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getDepName()!=null) {
            placementPreview02.setText(AppConfig.DISARMTRAPBEAN.getObject().getDepName());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getBedNo()!=null) {
            placementPreview03.setText(AppConfig.DISARMTRAPBEAN.getObject().getBedNo());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getHospitalNo()!=null) {
            placementPreview04.setText(AppConfig.DISARMTRAPBEAN.getObject().getHospitalNo());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getPatientName()!=null) {
            placementPreview05.setText(AppConfig.DISARMTRAPBEAN.getObject().getPatientName());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getDeviceName()!=null) {
            placementPreview06.setText(AppConfig.DISARMTRAPBEAN.getObject().getDeviceName());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getDoctor()!=null) {
            placementPreview07.setText(AppConfig.DISARMTRAPBEAN.getObject().getDoctor());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getPersonLiable()!=null) {
            placementPreview08.setText(AppConfig.DISARMTRAPBEAN.getObject().getPersonLiable());
        }
        if(AppConfig.DISARMTRAPBEAN.getObject().getAuditor()!=null) {
            placementPreview09.setText(AppConfig.DISARMTRAPBEAN.getObject().getAuditor());
        }
    }


    @OnClick(R.id.titlebar_docadvice_img_back)
    public void onViewClicked() {
        finish();
    }
}
